package com.hp.controller;

import com.hp.service.FileService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/upload")
public class UploadController {

    @Resource
    private FileService fileService;

    @RequestMapping("/oss")
    public String oss(MultipartFile file) throws IOException {
        String url = fileService.upload(file);
        System.out.println(url);
        return url;
    }
}
